<?php
declare (strict_types = 1);

namespace app\middleware;

use app\lib\Jwt;

class CheckLogin
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        $token=Jwt::getRequestToken();
        $data=Jwt::verifyjwt($token)->getData();
        if($data['code']==200){
            return $next($request);
        }
//        未登录跳转到登录页面
        return redirect('loginShow');
    }
}
